Where R←⍸Y

Classic Edition: the symbol (Iota Underbar) is not available in Classic Edition, and Where is instead represented by ⎕U2378.

Y must be a simple Boolean array.

R is a vector of the indices of all the 1s in Y. If Y is all zeros, R is an empty vector.

⎕IO is an implicit argument of Where.

Examples

      ⎕IO
1
      ⍸ 1 0 1 0 0 0 0 1 0
1 3 8

      ⍸'e'='Pete'
2 4

      3 4⍴0 1 1
0 1 1 0
1 1 0 1
1 0 1 1

      ⍸ 3 4⍴0 1 1
┌───┬───┬───┬───┬───┬───┬───┬───┐
│1 2│1 3│2 1│2 2│2 4│3 1│3 3│3 4│
└───┴───┴───┴───┴───┴───┴───┴───┘

      ⍸2 3 4⍴0 0 0 0 1
┌─────┬─────┬─────┬─────┐
│1 2 1│1 3 2│2 1 3│2 2 4│
└─────┴─────┴─────┴─────┘

      ⍸3 1 4 2
DOMAIN ERROR
      ⍸3 1 4 2
     ∧